<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <title>Docker自动构建部署平台</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/materialize/0.97.0/css/materialize.min.css">
    <link href="/css/icon.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/materialize/0.97.0/js/materialize.min.js"></script>
    <style>
        td {
            text-align: center !important;
        }
    </style>
</head>
<body style="font-family: 'Roboto', 'Droid Sans Fallback', '微软雅黑'; min-height: 100vh;display: flex;flex-direction: column;">

<nav>
    <div class="nav-wrapper">
        <a href="/" class="brand-logo center">Docker自动化构建部署平台</a>
        <ul class="left hide-on-med-and-down">
            <li><a href="/">首页</a></li>
        </ul>
    </div>
</nav>


<div id="alert-modal" class="modal">
    <div class="modal-content">
        <p class="grey-text">提示</p>
        <p class="text-alert"></p>
    </div>
    <div class="modal-footer">
        <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">关闭</a>
    </div>
</div>

<div class="container" style="padding-top: 20px; width: 90%;flex: 1 0 auto;">
    <div class="row">
        <div class="col s12">
            <ul class="tabs">
                <li class="tab col s6"><a href="#java-deploy">镜像列表</a></li>
            </ul>
        </div>
    </div>

    <div id="java-deploy">
        <table class="hoverable">
            <thead>
            <tr>
                <td width="20%">镜像ID</td>
                <td width="20%">Tags</td>
                <td width="20%">描述</td>
                <td width="20%">创建时间</td>
                <td width="20%">操作</td>
            </tr>
            </thead>
            <tbody>

            <#list images as item>
                <tr>
                    <td class="showId">${item.id}</td>
                    <td>
                        <#list item.repoTags as i>
                            <p>${i}</p>
                        </#list>
                    </td>
                    <td>

                        <#if item.labels?exists>
                            <#list item.labels?keys as key>
                                <p>${key}---${item.labels[key]}</p>
                            </#list>
                        </#if>

                    </td>
                    <td class="showTime">${item.created}</td>
                    <td>
                        <a href="/docker/imageDel/${item.id}"
                           class="btn waves-effect waves-light red lighten-2">删除</a>
                    </td>
                </tr>
            </#list>
            </tbody>
        </table>
    </div>


</div>
<script>

    <#if error?exists>
    Materialize.toast('${error}', 6000)
    </#if>

    $(".showTime").each(function () {
        var reg = new RegExp(',', "g")
        $(this).text(formatDate(parseInt($(this).text().replace(reg, ""))));
    });

    function formatDate(str) {
        var now = new Date(str * 1000);
        var year = now.getFullYear();
        var month = now.getMonth() + 1;
        var date = now.getDate();
        var hour = now.getHours();
        var minute = now.getMinutes();
        var second = now.getSeconds();
        return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
    }

    $(".showId").each(function () {
        var id = $(this).text();
        var sub = id.substr(0, 30);
        $(this).text(sub);
    });

</script>

</body>
</html>